from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from hyrobot.common import CHECK_POINT, STEP

class c73301b:
    name = "验证用户登录时账号/密码为空提示功能-73301b"
    driver = webdriver.Firefox()

    def teststeps(self):
        STEP(1, '进入客户服务平台网页')
        self.driver.implicitly_wait(3)
        self.driver.get("http://172.17.66.19:8080/")

        STEP(4, '输入已注册账号，不输入密码，点击登录')

        self.driver.find_element(By.NAME, "username").send_keys('user4')
        # psw.send_keys('')
        self.driver.find_element(By.CSS_SELECTOR, ".el-button").click()
        # got_warning_username2 = self.driver.find_element(By.CSS_SELECTOR, "div.el-form-item__error:nth-child(3)").text
        expected_warning2 = "密码不能少于六位"
        got_warning_psw2 = self.driver.find_element(By.CSS_SELECTOR, "div.el-form-item__error:nth-child(4)").text
        # got_warning_list2 = []
        # got_warning_list.append(got_warning_username2)
        # got_warning_list.append(got_warning_psw2)
        CHECK_POINT("验证是否为期待文字组合", expected_warning2 == got_warning_psw2)

        self.driver.quit()